package com.xyy.saas.payment.cores.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

/**
 * 开户意愿申请单状态
 */
public enum OpenAccountApplyStatusEnum {

    // 状态枚举名和微信同步
    IN_CREATE("IN_CREATE",0,"创建中", ""),
    APPLYMENT_STATE_WAITTING_FOR_AUDIT("APPLYMENT_STATE_WAITTING_FOR_AUDIT",1,"审核中", ""),
    APPLYMENT_STATE_EDITTING("APPLYMENT_STATE_EDITTING",2,"编辑中", ""),
    APPLYMENT_STATE_WAITTING_FOR_CONFIRM_CONTACT("APPLYMENT_STATE_WAITTING_FOR_CONFIRM_CONTACT",3,"待确认联系信息", "请扫描微信支付返回的小程序码确认联系信息(此过程可修改超级管理员手机号)"),
    APPLYMENT_STATE_WAITTING_FOR_CONFIRM_LEGALPERSON("APPLYMENT_STATE_WAITTING_FOR_CONFIRM_LEGALPERSON",4,"待账户验证", "请扫描微信支付返回的小程序码在小程序端完成账户验证"),
    APPLYMENT_STATE_PASSED("APPLYMENT_STATE_PASSED",5,"审核通过", "请扫描微信支付返回的小程序码在小程序端完成授权流程"),
    APPLYMENT_STATE_REJECTED("APPLYMENT_STATE_REJECTED",6,"审核驳回", ""),
    APPLYMENT_STATE_FREEZED("APPLYMENT_STATE_FREEZED",7,"已冻结", "可能是该主体已完成过入驻，请查看驳回原因，并通知驳回原因中指定的联系人扫描微信支付返回的小程序码在小程序端完成授权流程"),
    APPLYMENT_STATE_CANCELED("APPLYMENT_STATE_CANCELED",8,"已作废", "");

    private String code;
    private int status;
    private String desc;
    private String tips;

    private static Map<String,OpenAccountApplyStatusEnum> code2Enum;

    static {
        code2Enum = Arrays.asList(values()).stream().collect(Collectors.toMap(OpenAccountApplyStatusEnum::getCode, UnaryOperator.identity()));
    }

    OpenAccountApplyStatusEnum(String code, int status, String desc, String tips){
        this.code = code;
        this.status = status;
        this.desc = desc;
        this.tips = tips;
    }

    public static OpenAccountApplyStatusEnum getEnum(String code) {
        return code2Enum.get(code);
    }

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public String getTips() {
        return tips;
    }

    public String getCode() {
        return code;
    }
}
